home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / MATH / NRPAS13 / QUAD3D.DEM < prev    next >
Text File  |  1991-04-29  |  967b  |  52 lines

  1. PROGRAM d4r9(input,output);
  2. (* driver for routine QUAD3D *)
  3. CONST
  4.    pi=3.1415926;
  5.    nval=10;
  6. VAR
  7.    i : integer;
  8.    s,xmax,xmin,xmax5 : real;
  9.    glx,gly : real;
  10.  
  11. FUNCTION func(x,y,z: real): real;
  12. BEGIN
  13.    func := sqr(x)+sqr(y)+sqr(z)
  14. END;
  15.  
  16. FUNCTION z1(x,y: real): real;
  17. BEGIN
  18.    z1 := -sqrt(sqr(xmax)-sqr(x)-sqr(y))
  19. END;
  20.  
  21. FUNCTION z2(x,y: real): real;
  22. BEGIN
  23.    z2 := sqrt(sqr(xmax)-sqr(x)-sqr(y))
  24. END;
  25.  
  26. FUNCTION y1(x: real): real;
  27. BEGIN
  28.    y1 := -sqrt(sqr(xmax)-sqr(x))
  29. END;
  30.  
  31. FUNCTION y2(x: real): real;
  32. BEGIN
  33.    y2 := sqrt(sqr(xmax)-sqr(x))
  34. END;
  35.  
  36. (*$I MODFILE.PAS *)
  37.  
  38. (*$I QUAD3D.PAS *)
  39.  
  40. BEGIN
  41.    writeln('Integral of r^2 over a spherical volume');
  42.    writeln;
  43.    writeln('radius':13,'QUAD3D':9,'Actual':10);
  44.    FOR i := 1 to nval DO BEGIN
  45.       xmax := 0.1*i;
  46.       xmin := -xmax;
  47.       quad3d(xmin,xmax,s);
  48.       xmax5 := sqr(sqr(xmax))*xmax;
  49.       writeln(xmax:12:2,s:10:4,4.0*pi*(xmax5)/5.0:10:4)
  50.    END
  51. END.
  52.